package com.zzyl.nursing.job;


import com.zzyl.nursing.domain.Elder;
import com.zzyl.nursing.domain.HealthAssessment;
import com.zzyl.nursing.domain.NursingPlan;
import com.zzyl.nursing.domain.NursingTask;
import com.zzyl.nursing.mapper.ElderMapper;
import com.zzyl.nursing.mapper.HealthAssessmentMapper;
import com.zzyl.nursing.mapper.NursingPlanMapper;
import com.zzyl.nursing.mapper.NursingTaskMapper;
import com.zzyl.nursing.service.impl.NursingTaskServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("NursingTaskAdd")
public class NursingTaskAdd {
    @Autowired
    private NursingTaskServiceImpl nursingTaskService;

    @Autowired
    private HealthAssessmentMapper healthAssessmentMapper;

    @Autowired
    private ElderMapper elderMapper;

    public void addNursingTask() {
        // 1.拿到任务安排需要的数据
        System.out.println("执行定时任务: " + System.currentTimeMillis());
        Elder elder = new Elder();
        List<Elder> elders = elderMapper.selectElderList(elder);
        for (Elder elder1 : elders) {
            nursingTaskService.createMonthTask(elder1);
        }
    }

}
